package com.duobaoyu.dby.supply.biz.service.order;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.duobaoyu.dby.supply.biz.client.boundary.order.bean.bo.OrderBO;
import com.duobaoyu.dby.supply.biz.client.boundary.order.bean.bo.SaveOrderRepairBO;
import com.duobaoyu.dby.supply.biz.enums.OrderRepairStatusEnum;
import com.duobaoyu.dby.supply.common.biz.bo.order.OrderRepairBO;
import com.duobaoyu.dby.supply.common.biz.bo.order.OrderRepairRecordBO;
import com.duobaoyu.dby.supply.common.biz.bo.order.UpdateOrderRepairBO;
import com.duobaoyu.dby.supply.common.biz.bo.order.UpdateOrderRepairRecordBO;
import com.duobaoyu.dby.supply.common.biz.dto.order.OrderRepairPageDTO;
import com.duobaoyu.dby.supply.common.biz.vo.order.OrderRepairPageVO;

import java.util.List;

/**
 * @author chenms
 * @date 2023/10/17 1:53 PM
 */
public interface OrderRepairService {

    /**
     * 保存补单数据
     */
    boolean saveRepairOrderList(List<SaveOrderRepairBO> orderRepairList);


    /**
     * 生成SaveOrderRepairBO
     */
    SaveOrderRepairBO genSaveOrderRepair(OrderBO order, String errorCode, String errorMessage);

    /**
     * 补单分页查询
     */
    Page<OrderRepairPageVO> page(OrderRepairPageDTO orderRepairPage);

    /**
     * 获取数量
     */
    long count(OrderRepairPageDTO orderRepairPage);


    /**
     * 状态检查
     * @param orderSnList 订单号
     * @param expectStatusList 期望的订单状态
     */
    List<OrderRepairBO> statusCheck(List<String> orderSnList, List<OrderRepairStatusEnum> expectStatusList);

    /**
     * 保存补单记录
     * @param orderRepair 补单
     */
    OrderRepairRecordBO saveRepairRecord(OrderRepairBO orderRepair);

    /**
     * 更新补单数据状态和失败信息
     */
    void updateOrderRepairStatusAndErrorInfo(UpdateOrderRepairBO updateOrderRepair);

    /**
     * 更新补单记录数据状态和失败信息
     */
    void updateRepairRecordStatusAndErrorInfo(UpdateOrderRepairRecordBO repairRecord);

    /**
     * 补单明细
     */
    OrderRepairBO getByOrderSn(String orderSn, boolean returnRecordList);

    /**
     * 获取订单补单记录
     * @param orderSnList 订单号
     * @param statusList 状态
     * @return
     */
    List<OrderRepairRecordBO> listOrderRepairRecord(List<String> orderSnList, List<Integer> statusList);
}
